package com.framework.core.utils;

/**
 * @author 樊猛 [986314249@qq.com]
 * @create 2018/6/1 9:31
 */
public class URIFormatUtil {

//    private static final String WILD_CARD = "*";
//    private static final String POINT = ".";
    private static final String[] fbsArr = new String[]{"\\", "$", "(", ")", "+", ".", "[", "]", "?", "^", "{", "}", "|"};

    public URIFormatUtil() {
    }

    public static String format(String str) {
        String[] var1 = fbsArr;
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            String key = var1[var3];
            if (str.contains(key)) {
                str = str.replace(key, "\\" + key);
            }
        }

        if (!str.contains("*")) {
            return str;
        } else {
            StringBuilder stringBuilder = new StringBuilder(str);
            stringBuilder.insert(str.indexOf("*"), ".");
            return stringBuilder.toString();
        }
    }
}
